//
//  ShapeFactory.m
//  工厂模式
//
//  Created by flannery on 2018/12/17.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "ShapeFactory.h"

@implementation ShapeFactory
- (id<Shape>)getShape:(NSString *)shapeType{
    if(shapeType == nil) {
        return nil;
    }
    if([shapeType isEqualToString:@"CIRCLE"]) {
        return Circle.new;
    } else if([shapeType isEqualToString:@"RECTANGLE"]) {
        return Rectangle.new;
    } else if([shapeType isEqualToString:@"SQUARE"]) {
        return Square.new;
    }
    return nil;
}
@end
